﻿Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class Symbol3D
    Public Enum Zeichenarten
        Treibstoff
        Munition
        Tarnung
        Besetzen
        Ladung
    End Enum
    Private Shared SymbolMeshs(4) As Objekt3D
    Private Shared SymbolPosRel(4) As Vector3
    Private Shared Rot As Single = 0

    Public Shared Sub Ini()
        SymbolMeshs(0) = New Objekt3D
        SymbolMeshs(0).MeshBildLaden(DataSettings.Resourcenpfad + "\Objects\Benzin.x")
        SymbolPosRel(0) = New Vector3(0, 0.3, 0)
        SymbolMeshs(1) = New Objekt3D
        SymbolMeshs(1).MeshBildLaden(DataSettings.Resourcenpfad + "\Objects\Munition.x")
        SymbolPosRel(1) = New Vector3(0.5, 0.3, 0)
        SymbolMeshs(2) = New Objekt3D
        SymbolMeshs(2).MeshBildLaden(DataSettings.Resourcenpfad + "\Objects\Tarnung.x")
        SymbolPosRel(2) = New Vector3(-0.5, 0.3, 0)
        SymbolMeshs(3) = New Objekt3D
        SymbolMeshs(3).MeshBildLaden(DataSettings.Resourcenpfad + "\Objects\Besetzen.x")
        SymbolPosRel(3) = New Vector3(0, 0.3, 0.5)
        SymbolMeshs(4) = New Objekt3D
        SymbolMeshs(4).MeshBildLaden(DataSettings.Resourcenpfad + "\Objects\Ladung.x")
        SymbolPosRel(4) = New Vector3(0, 0.3, -0.5)
    End Sub
    Public Shared Sub Symbolmalen(ByVal Ortsvektor As Vector3, ByVal Zeichen As Zeichenarten)
        Dim ind As Integer = Zeichen
        Dim Mat As Matrix = Matrix.RotationY(Rot)
        Mat.M41 = Ortsvektor.X + SymbolPosRel(ind).X
        Mat.M42 = Ortsvektor.Y + SymbolPosRel(ind).Y
        Mat.M43 = Ortsvektor.Z + SymbolPosRel(ind).Z
        'Grafikengine.Grafikkarte.RenderState.ZBufferEnable = False
        SymbolMeshs(ind).Malen(Mat)
        'Grafikengine.Grafikkarte.RenderState.ZBufferEnable = True
    End Sub

    Public Shared Sub Berechnen()
        Rot += 0.01
        If Rot > Math.PI * 2 Then
            Rot = 0
        End If
    End Sub
End Class
